# 层级定位
import time

from selenium import webdriver
import os
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome()
file = "file:///" + os.path.abspath("e:\比特课件\selenium2html\level_locate.html")
driver.get(file)
driver.maximize_window()
driver.find_element_by_link_text("Link1").click()

# 定位下拉列表特定的元素
d1 = driver.find_element_by_id("dropdown1")
d2 = d1.find_element_by_link_text("Another action")
# 把鼠标放到这个元素上，让元素高亮展示
ActionChains(driver).move_to_element(d2).perform()
time.sleep(3)
driver.quit()